package com.yanqu.road.dao.db;

import com.yanqu.road.entity.log.maidian.BaseDataAttributeCustomGet;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description 数据库表的映射信息
 * @Author cwq
 * @Data 2022/4/25 18:04
 */
public class TableInfo {

    /** 数据表名,须被初始化 */
    String tableName;
    /** 数据库保存sql */
    String saveSql;

    /** 映射的数据类 */
    Class cls;
    /** 对应的数据库 */
    String db;

    /**
     * 字段列表
     */
    private List<DbFieldInfo> fieldInfoList = new ArrayList<>();

    /** 主键字段 */
    private List<String> pkList;

    /** 索引字段 */
    private List<String> indexList;

    /**是否上传数数平台*/
    boolean dataUpload;
    /**数数埋点事件名*/
    String eventName;
    /**
     * 埋点自定义get方法
     */
    Map<String, Class<? extends BaseDataAttributeCustomGet>> customAttributeMap;


    /**
     * clickhouse 的order by (二级索引)
     */
    private List<String> orderByList;
    /**
     * clickhouse的 partition
     */
    private String cKPartition = null;
    /**
     * clickhouse的 分片键
     */
    private String skuId;

    /**
     * 是否上传CK
     */
    boolean uploadCk;

    public String getTableName() {
        return tableName;
    }

    public TableInfo setTableName(String tableName) {
        this.tableName = tableName;
        return this;
    }

    public String getSaveSql() {
        return saveSql;
    }

    public TableInfo setSaveSql(String saveSql) {
        this.saveSql = saveSql;
        return this;
    }

    public Class getCls() {
        return cls;
    }

    public TableInfo setCls(Class cls) {
        this.cls = cls;
        return this;
    }

    public String getDb() {
        return db;
    }

    public TableInfo setDb(String db) {
        this.db = db;
        return this;
    }

    public boolean isDataUpload() {
        return dataUpload;
    }

    public void setDataUpload(boolean dataUpload) {
        this.dataUpload = dataUpload;
    }

    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    public Map<String, Class<? extends BaseDataAttributeCustomGet>> getCustomAttributeMap() {
        return customAttributeMap;
    }

    public void setCustomAttributeMap(Map<String, Class<? extends BaseDataAttributeCustomGet>> customAttributeMap) {
        this.customAttributeMap = customAttributeMap;
    }

    public List<DbFieldInfo> getFieldInfoList() {
        return fieldInfoList;
    }

    public void setFieldInfoList(List<DbFieldInfo> fieldInfoList) {
        this.fieldInfoList = fieldInfoList;
    }

    public List<String> getPkList() {
        return pkList;
    }

    public void setPkList(List<String> pkList) {
        this.pkList = pkList;
    }

    public void setIndexList(List<String> indexList) {
        this.indexList = indexList;
    }

    public List<String> getIndexList() {
        return indexList;
    }

    public List<String> getOrderByList() {
        return orderByList;
    }

    public void setOrderByList(List<String> orderByList) {
        this.orderByList = orderByList;
    }

    public String getcKPartition() {
        return cKPartition;
    }

    public void setcKPartition(String cKPartition) {
        this.cKPartition = cKPartition;
    }

    public String getSkuId() {
        return skuId;
    }

    public void setSkuId(String skuId) {
        this.skuId = skuId;
    }

    public boolean isUploadCk() {
        return uploadCk;
    }

    public void setUploadCk(boolean uploadCk) {
        this.uploadCk = uploadCk;
    }
}
